﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sealight.Core.DataAdapter;
namespace Sealight.Core.Domain
{
   public class NewsCategoryEntity
    {
       public virtual Guid NewsCategoryID { get; set; }
       public virtual Guid ParentID { get; set; }
       public virtual string Name { get; set; }
       public virtual string Code { get; set; }
       public virtual bool IsActive { get; set; }
       public virtual DateTime CreatedDate { get; set; }
       public virtual DateTime UpdatedDate { get; set; }

       public virtual IList<NewsCategoryEntity> Children { get; set; }
       public virtual LanguageEntity Language { get; set; }

       public virtual news_category ToDataAdapter()
       {
           news_category entity = new news_category
           {
               id = this.NewsCategoryID,
               parent_id = this.ParentID,
               name = this.Name,
               code = this.Code,
               is_active = this.IsActive,
               created_date = this.CreatedDate,
               updated_date = this.UpdatedDate,
               language = this.Language.ToDataAdapter()
           };

           if (this.Children != null)
           {
               entity.children = new List<news_category>();

               foreach (NewsCategoryEntity data in this.Children)
               {
                   entity.children.Add(data.ToDataAdapter());
               }
           }

           return entity;
       }
    }
}
